package 每日一题OJ;

/**
 * @author shy_black
 * @date 2019/8/19 21:07
 * @Description:
 */
public class 反转字符串 {
    public void reverseString(char[] s) {
        int L = 0;
        int R = 0;
        int i = 0;
        if(s.length <= 0)
            return;
        if(s.length == 1){
            System.out.print(s[0]);
        }
        while(i < s.length/2) {
            L = i;
            R = s.length-1-i;

            char tmp = s[L];
            s[L] = s[R];
            s[R] = tmp;

            i++;
        }
        for(char j : s) {
            System.out.print(j);
        }
    }
}